package com.example.shop.pojo;

import com.baomidou.mybatisplus.annotation.FieldFill;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.extension.activerecord.Model;

import java.time.LocalDate;

import com.fasterxml.jackson.annotation.JsonAlias;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.datatype.jsr310.deser.LocalDateDeserializer;
import com.fasterxml.jackson.datatype.jsr310.deser.LocalDateTimeDeserializer;
import com.fasterxml.jackson.datatype.jsr310.ser.LocalDateSerializer;
import com.fasterxml.jackson.datatype.jsr310.ser.LocalDateTimeSerializer;
import lombok.Data;
import lombok.Getter;
import lombok.Setter;
import lombok.experimental.Accessors;

/**
* <p>
* 用户
* </p>
*
* @author 作者
* @since 2022-05-29
*/
@Data
@Accessors(chain = true)
public class User extends Model<User> {
  @TableField(exist = false)
  public static final String RESOURCE_ROOT_DIR = "D://electricity_shop//resources//user//";
  private static final long serialVersionUID = 1L;

  @TableId(value = "user_id", type = IdType.ASSIGN_ID)
  //用户的唯一标识
  private Long userId;
  @TableField(value = "user_avatar")
  //用户头像
  private String userAvatar;
  @TableField(value = "user_name")
  //用户名
  private String userName;
  @TableField(value = "user_sex")
  //性别
  private String userSex;
  @TableField(value = "user_area")
  //所在地区
  private String userArea;
  @TableField(value = "user_date_birth")
  @JsonDeserialize(using = LocalDateDeserializer.class)
  @JsonSerialize(using = LocalDateSerializer.class)
  @JsonFormat(pattern = "yyyy-MM-dd",timezone = "GMT+8")
  //出生日期
  private LocalDate userDateBirth;
  @TableField(value = "user_account")
  //用户账户
  private String userAccount;
  @TableField(value = "user_password")
  //用户密码
  private String userPassword;
  //人脸token
  private String userFaceToken;
  @TableField(value = "user_phone")
  //用户的电话
  private String userPhone;
  @TableField(value = "user_email")
  //用户的邮箱
  private String userEmail;
  @TableField(value = "user_signature")
  //个性签名
  private String userSignature;
  //用户状态
  private byte userState;

  @TableField(value = "user_resource_dir")
  //用户的资源目录,即userResourceDirRoot+用户账户
  private String userResourceDir;
  //该用户的注册账户的注册时间
  @JsonDeserialize(using = LocalDateDeserializer.class)
  @JsonSerialize(using = LocalDateSerializer.class)
  @JsonFormat(pattern = "yyyy-MM-dd",timezone = "GMT+8")
  @TableField(fill = FieldFill.INSERT)
  private LocalDate userRegisterDate;



  @Override
  public String toString() {
    return "User{" +
            "userId=" + userId +
            ", userAvatar='" + userAvatar + '\'' +
            ", userName='" + userName + '\'' +
            ", userSex='" + userSex + '\'' +
            ", userArea='" + userArea + '\'' +
            ", userDateBirth=" + userDateBirth +
            ", userAccount='" + userAccount + '\'' +
            ", userPassword='" + userPassword + '\'' +
            ", userFaceToken='" + userFaceToken + '\'' +
            ", userPhone='" + userPhone + '\'' +
            ", userEmail='" + userEmail + '\'' +
            ", userSignature='" + userSignature + '\'' +
            ", userState=" + userState +
            ", userResourceDir='" + userResourceDir + '\'' +
            ", userRegisterDate=" + userRegisterDate +
            '}';
  }
}
